import Vue from 'vue'
import Router from 'vue-router'

// 引入布局组件
import Layout from '../layout/Layout.vue'

// 工作台
import WorkSpace from '../views/WorkSpace.vue'
// 生产管理
import ProductMemu from '@/layout/ProductMemu.vue'
import ProductManage from '../views/product-manage/index.vue'
// 生产管理---子路由
import ProductOrder from '../views/product-manage/Order.vue'
import ProductPlan from '../views/product-manage/Plan.vue'

// 统计报表
import ReportMenu from '../layout/ReportMenu.vue'
import StatisticalReports from '../views/statistical-reports/index.vue'
// 统计报表---子路由
import ReportOrder from '../views/statistical-reports/Order.vue'
import ReportOutput from '../views/statistical-reports/OutPut.vue'


import QualityManage from '../views/QualityManage.vue'
import InventoryManage from '../views/InventoryManage.vue'
import FactoryInformation from '../views/FactoryInformation.vue'
import Setting from '../views/Setting.vue'


Vue.use(Router);

export default new Router({
  mode: "history",
  routes: [
    // 工作台
    {
      path: "/",
      // component: WorkSpace
      components: {
        default: WorkSpace
      }
    },
    // 生产管理
    {
      path: "/product-manage",
      components: {
        sidebar: ProductMemu,
        content: ProductManage,
      },
      // 子路由
      children: [
        {
          path: '',
          redirect: '/product-manage/order'
        },
        {
          path: 'order',
          component: ProductOrder
        },
        {
          path: 'plan',
          component: ProductPlan
        }
      ]
    },
    // 统计报表
    {
      path: "/statistical-reports",
      components: {
        sidebar: ReportMenu,
        content: StatisticalReports
      },
      // 子路由
      children: [
        {
          path: '',
          redirect: '/statistical-reports/order'
        },
        {
          path: 'order',
          component: ReportOrder
        },
        {
          path: 'output',
          component: ReportOutput
        }
      ]
    },
    {
      path: "/quality-manage",
      component: QualityManage
    },
    {
      path: "/inventory-manage",
      component: InventoryManage
    },
    {
      path: "/factory-information",
      component: FactoryInformation
    },
    {
      path: "/setting",
      component: Setting
    }
  ]
})